<script setup>
import { reactive, ref,onMounted, watch } from 'vue';
import PersonalInformation from '../components/PersonalInformation.vue';
import PersonResume from "../components/PersonResume.vue"
import {useUserInfoByUid,useUserResume,useUpdateResume} from "api/user"
import { useRoute,useRouter } from 'vue-router';
import Loading from "../components/Loading.vue";
import useLoadData from '../hooks/useLoadData';
const route = useRoute()
const router = useRouter()
const {isError,isLoading,data}=useLoadData(useUserInfoByUid(route.params.uid))
const info = ref({})

onMounted(async ()=>{

})
watch(data,()=>{
    if(data.value){
        useUserResume(route.params.uid).then(res=>{
            info.value = {...data.value,...res.data}
        })
    }
})
//获取个人信息
</script>

<template>
    <Loading :is-error="isError" :is-loading="isLoading" class="container">
		<PersonalInformation :data="info"></PersonalInformation>
		<PersonResume :data="info"></PersonResume>
        <van-button round type="primary" color="var(--main-gradient)">发送私信</van-button>
    </Loading>
</template>

<style scoped>
.container{
    position: relative;
    padding: var(--page-padding);
    min-height: 100%;
    background-color: white;
    box-sizing: border-box;
}
.top-info{
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.info div{
    margin: 12px;
}
.name{
    display: flex;
    align-items: center;
    margin: 0px;
}
.name div{
    margin: 0px;
    margin-right: 5px;
}
.title{
    display: inline-block;
    background-image: var(--main-gradient);
    background-size: 100% 20%;
    background-repeat: no-repeat;
    background-position: bottom;
    padding-bottom: 5px;
    font-weight: bold;
}
.content{
    padding-top: 16px;
}
.van-button{
    position: absolute;
    margin: auto;
    width: 95%;
    left:0;
    right:0;
    bottom:0;
    bottom:20px
}
</style>